#ifndef __MOD_INDO_HPP__
#define __MOD_INDO_HPP__

#include <string>
#include "nlohmann/json.hpp"

namespace PocketSurvival
{
    struct ModInfo
    {
        std::string md5Value;
        std::string name;
        std::string packageName;
        std::string verison;

        friend inline bool operator==(const ModInfo &left, const ModInfo &right)
        {
            return (left.md5Value == right.md5Value) && (left.name == right.name) && (left.packageName == right.packageName) && (left.verison == right.verison);
        }
        friend inline void to_json(nlohmann::json &json, const ModInfo &info);
        friend inline void from_json(const nlohmann::json &json, ModInfo &info);
    };

    inline void to_json(nlohmann::json &json, const ModInfo &info)
    {
        json = {{"Md5Value",info.md5Value},{"Name",info.name},{"PackageName",info.packageName},{"Verison",info.verison}};
    }
    inline void from_json(const nlohmann::json &json, ModInfo &info)
    {
        info.md5Value       = json["Md5Value"].get<std::string>();
        info.name           = json["Name"].get<std::string>();
        info.packageName    = json["PackageName"].get<std::string>();
        info.verison        = json["Verison"].get<std::string>();
    }

}

#endif
